<template>
  <p>孙子组件1</p>
  <p>{{ info }}</p>
  <p>{{ msg1 }}--{{ msg2 }}</p>
  <el-button @click="handClick" type="primary">传值给兄弟组件</el-button>
  <el-button @click="handClick2" type="primary">改变msg1的值</el-button>
</template>

<script setup>
import { inject } from "vue";
import emitter from "@/utils/eventBus";
defineProps(["msg1", "msg2"]);
const emit = defineEmits(["changeMsg1"]);
const info = inject("info");
const handClick = () => {
  emitter.emit("myEvent", "传值给兄弟组件得值123");
};
const handClick2 = () => {
  emit("changeMsg1", "msg112");
};
</script>

<style lang="scss" scoped></style>
